<template>
	<div>
		<div class="loan_nav col_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>缴纳剩余费用</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="flex_box">
			<div class="interval_T">

			</div>
			<div class="loan_detail">
				<ul>
					<li>
						<p>贷款人：
							<span>{{applyInfo.userName}}</span>
						</p>
						<p>贷款类型：
							<span>{{applyInfo.loansType}}</span>
						</p>
						<p>需缴纳费用：
							<span>{{applyInfo.serviceCharge2}}</span>
						</p>
					</li>
					<li>
						<p>贷款时间：
							<span>{{applyInfo.createDate ? applyInfo.createDate.split(' ')[0] : ''}}</span>
						</p>
						<p>贷款金额：
							<span>{{applyInfo.loansInterval}}</span>
						</p>

					</li>
				</ul>
			</div>
		</div>
		<div class="Parting_line2 Parting_l">

		</div>
		<!-- <div class="recharge">
            <ul>
                <li>
                    <p>储蓄卡</p>
                </li>
                <li>
                    <p @click="showHideOnBlur=true">{{radioValue[0]}}</p>
                    <p>单日交易限额¥50000.00</p>
                </li>
            </ul>
        </div> -->
		<div class="recharge_money" style="margin-top:0.2rem;">
			<ul>
				<li>
					<input @click="save" type="button" value="立即缴纳" class="col-green">
				</li>
			</ul>
		</div>
	</div>
</template>
<script>
export default {
	data() {
		return {
			applyInfo: {}
		}
	},
	created() {
		this.query()
	},
	methods: {
		query() {
			const id = this.$route.params.id
			this.$http.get(`/app/loan/info/${id}`).then(json => {
				const { code, loan } = json
				if (code === 0) {
					this.applyInfo = loan
				}
			})
		},
		save() {
			const vm = this
			vm.$vux.confirm.show({
				title: '确认缴纳',
				showInput: true,
				inputAttrs: {
					type: 'password'
				},
				placeholder: '请输入资金密码',
				onConfirm(val) {
					if(!val || val === '') return vm.$vux.toast.show({ type: 'cancel', text: '密码不能为空' })
					vm.$http.post('/app/loan/pay', {
						id: vm.$route.params.id,
						password: val
					}).then(json => {
						const { code } = json
						if (code === 0) {
							vm.$vux.toast.show('缴纳成功')
							vm.$router.back()
						} else if (code === 333) {
							vm.$router.push('/recharge')
						} else if (code === 332) {
							vm.$router.push('/paymentpassword')
						}
					})
				}
			})


		}
	}
}
</script>
<style>

</style>


